package com.xr.singleton.mapper;


import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.xr.singleton.model.entity.ResourceEntity;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface ResourceMapper extends BaseMapper<ResourceEntity> {

    @Select("SELECT tre.* FROM `t_user` tu, `t_role` tro, `t_resource` tre, `t_user_role` tur, `t_role_resource` trr WHERE tu.id = tur.user_id AND tro.id = tur.role_id AND tro.id = trr.role_id AND tre.id = trr.resource_id AND tu.id = #{id}")
    List<ResourceEntity> listByUserId(Long id);

}